package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;

import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iMovieDAO;
import xupt.se.ttms.model.Movie;

public class MovieSrv {
	private iMovieDAO movieDAO=DAOFactory.creatMovieDAO();
	public boolean add(Movie movie) throws Exception{
		
		return movieDAO.execInsert(movie);
	}
	
	public boolean modify(Movie movie) throws Exception{
		return movieDAO.execUpdate(movie); 		
	}
	
	public boolean delete(int ID) throws Exception{
		return movieDAO.execDelete(ID);		
	}
	
	public List<Movie> Fetch(String condt) throws Exception{
		ResultSet resultSet=movieDAO.execQuery(condt);	
		return movieDAO.HandleMovieResultSet(resultSet);	
	}
	public List<Movie> Fetch(int i) throws Exception{
		ResultSet resultSet=movieDAO.execQuery(i);
		return movieDAO.HandleMovieResultSet(resultSet);	
	}
	public List<Movie> FetchHot(float f) throws Exception{
		ResultSet resultSet=movieDAO.execQueryHot(f);
		return movieDAO.HandleMovieResultSet(resultSet);	
	}
	public List<Movie> FetchRecom(float f) throws Exception{
		ResultSet resultSet=movieDAO.execQueryRecommend(f);
		return movieDAO.HandleMovieResultSet(resultSet);	
	}
	public List<Movie> FetchNew(int date) throws Exception{
		ResultSet resultSet=movieDAO.execQueryNew(date);
		return movieDAO.HandleMovieResultSet(resultSet);	
	}
	public List<Movie> FetchAll() throws Exception{
		ResultSet resultSet=movieDAO.execQueryAll();
		return movieDAO.HandleMovieResultSet(resultSet);		
	}

	public List<Movie> FetchFuzzy(String name) throws Exception{
		ResultSet resultSet=movieDAO.execQueryFuzzy(name);
		return movieDAO.HandleMovieResultSet(resultSet);		
	}

}
